﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;

namespace FlexHighlighter.classification
{

    #region Classifier definitions

    [Export(typeof(ITaggerProvider))]
    [ContentType("Flex")]
    [TagType(typeof(ClassificationTag))]
    internal sealed class FlexClassifierProvider : IClassifierProvider
    {
        [Export] [Name("Flex")] //name of the content type
        [BaseDefinition("c/c++")] internal static ContentTypeDefinition FlexContentType = null;

        [Export] [FileExtension(".lex")] [ContentType("Flex")] //our custom content type.
            internal static FileExtensionToContentTypeDefinition FlexExtension = null;

        //import classification type registry
        [Import] internal IClassificationTypeRegistryService ClassificationTypeRegistry = null;

        [Import] internal IBufferTagAggregatorFactoryService AggregatorFactory = null;

        //public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
        //{

        //    ITagAggregator<FlexClassificationTag> flexTagAggregator =
        //        AggregatorFactory.CreateTagAggregator<FlexClassificationTag>(buffer);
        //    return new FlexClassifier() as ITagger<T>;
        //}

        public IClassifier GetClassifier(ITextBuffer textBuffer)
        {
            return new FlexClassifier();
        }
    }

    internal sealed class FlexClassifier : IClassifier
    {

        public event EventHandler<ClassificationChangedEventArgs> ClassificationChanged;

        public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span)
        {
            return null;
        }
    }

    #endregion


}
